Skip to content

NEW: @W-19397375@: Preserve working folders on error - #355

Merged
stephen-carter-at-sf merged 1 commit into
devfrom
sc/W-19397375
Sep 19, 2025
Merged

NEW: @W-19397375@: Preserve working folders on error#355
stephen-carter-at-sf merged 1 commit into
devfrom
sc/W-19397375

Conversation

@stephen-carter-at-sf

Copy link
Copy Markdown
Contributor

No description provided.

this.validateEnvironment(nodeVersion);
this.config = config;
this.tempFolder = new TempFolder(fileSystem);
/* istanbul ignore next */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify why this needed the ignore?

@stephen-carter-at-sf stephen-carter-at-sf Sep 19, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The callback is really what's ignored. The test could never measure this because the node process is on exit when the call back is fired. So no way to cover this with a unit test. Demo (end-to-end) shows things working though.

const describeOptions: engApi.DescribeOptions = {
workspace: engApiWorkspace,
workingFolder: await this.tempFolder.createSubfolder(describeWorkingFolderName, engineName),
workingFolder: workingFolder,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
workingFolder: workingFolder,
workingFolder,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup 😎

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually find that this syntax is super confusing and it ties the variable name to the field name. So I personally choose not to use this type of syntax from javascript typically. Just a personal preference.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, if I use my editor to rename a variable - it causes issues if I have "workingFolder" as both the fieldname and the variable. I might not want to change the field name... but may want to change the variable name and editors don't know this typically and get it wrong. Sometimes convenience and short code causes bugs... which is why I love static typing as well. :-)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me!

export interface TempFolder {
getPath(): Promise<string>;
createSubfolder(...subfolderPathSegs: string[]): Promise<string>;
export interface FileSystem {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good - I feel like it could use elevating out of utils.ts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it is an implementation detail utility in my opinion.

@randi274 randi274 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be great to for us to add for some additional debugging support!

@stephen-carter-at-sf
stephen-carter-at-sf merged commit ccac913 into dev Sep 19, 2025
7 checks passed
@stephen-carter-at-sf
stephen-carter-at-sf deleted the sc/W-19397375 branch September 19, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants